package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import java.util.Random;

import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class GroupRemovalTests extends TestBase{

	@Test
	public void deleteSomeGroup(){
		
		//save old groups list
		SortedListOf<GroupData> oldGroups = app.getGroupHelper().getGroups();
		
		Random rnd = new Random();
		int index = rnd.nextInt(oldGroups.size()-1);
				
		//delete some group
		app.getGroupHelper().deleteGroup(index);
		
		//save new groups list
		SortedListOf<GroupData> newGroups = app.getGroupHelper().getGroups();
		
		//compare lists
		assertThat(newGroups, equalTo(oldGroups.without(index)));	
	}
}
